<?php


use Phinx\Seed\AbstractSeed;

class CategorySeeder extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run()
    {
        $fileData = ['name' => '文件异常','code' => 'file_exception', 'type' => 'task_work_order_type', 'parent_id' => 0];
        $table    = $this->table('category');
        $table->insert($fileData)->save();

        $id = $this->getAdapter()->getConnection()->lastInsertId();

        $data = [
            [
                'name'      => '组装失败(超时)',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ],
            [
                'name'      => '开始失败(超时)',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ],
            [
                'name'      => '提交失败(超时)',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ],
            [
                'name'      => '渲染失败(超时)',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ],
            [
                'name'      => '发布失败(超时)',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ],
            [
                'name'      => '上传下载失败',
                'type'      => 'task_work_order_type',
                'parent_id' => $id
            ]
        ];

        $table->insert($data)->save();
    }
}
